#include <stdio.h>
#include <unistd.h>
#include <poll.h>

int main()
{
	struct pollfd rfds;
	rfds.fd = 0;
	rfds.events = POLLIN | POLLPRI;
	
	int timeout = 3000;

	int nfds = poll(&rfds, 1, timeout);

	if(nfds == -1)
		perror("poll()");
	else if (nfds)
		printf("Data is available now.\n");
	else
		printf("No data within five second.\n");

	return 0;
}
